{template 'common/header'}
<div class="main">
    <ul class="nav nav-tabs">
        <li><a href="{php echo $this->createWebUrl('formManage');}">商家管理</a></li>
        <li ><a href="{php echo url('platform/reply/post',array('m'=>'mon_orderform'));}">添加商家</a></li>
        <li><a href="{php echo $this->createWebUrl('OrderItemEdit',array('fid'=>$fid));}">添加订单类型</a></li>
        <li ><a href="{php echo $this->createWebUrl('OrderItemlist',array('fid'=>$fid));}">订单类型管理</a></li>
        <li class="active"><a href="{php echo $this->createWebUrl('Orderlist',array('fid'=>$fid));}">用户订单管理</a></li>
    </ul>



    <div class="panel panel-info">
        <div class="panel-heading">用户订单</div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="mon_orderform" />
                <input type="hidden" name="do" value="OrderList" />
                <input type="hidden" name="iid" value="{$iid}" />
                <input type="hidden" name="fid" value="{$fid}" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号</label>
                    <div class="col-sm-8 col-lg-9">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
                    </div>

                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
                    <div class="col-sm-8 col-lg-9">
                        <select name="status" class="form-control" style="float:left">
                            <option value="0"> 全部</option>
                             <option value="1" {if $status==1} selected='selected'{/if}>已下单</option>
                            <option value="2" {if $status==2} selected='selected'{/if}>未支付</option>
                            <option value="3" {if $status==3} selected='selected'{/if}>已支付</option>
                            <option value="4" {if $status==4} selected='selected'{/if}>已处理</option>
                        </select>
                    </div>
                    <div class=" col-xs-12 col-sm-2 col-lg-2">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    </div>
                </div>


            </form>
        </div>

    </div>



        <div class=" panel panel-default">
            <div class="panel-heading">

               共{$total} 订单

                <a type="button" class="btn btn-default" href="{php echo $this->createWebUrl('OrderDownload',array('oid'=>$oid,'dc'=>1))}">导出1(导出有编码错误时请尝试用导出2)</a>
                <a type="button" class="btn btn-default" href="{php echo $this->createWebUrl('OrderDownload',array('oid'=>$oid,'dc'=>2))}">导出2</a>

            </div>
        <div class="table-responsive panel-body">

            <div style="padding:15px;">

                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 5px">
                            <input type="checkbox" class="check_all" />
                        </th>
                        <th style="width: 150px">订单号</th>
                        <th style="width: 100px">用户</th>
                        <th style="width: 120px">手机</th>
                        <th style="width: 80px">数量</th>
                        <th style="width: 120px">类型</th>
                        <th style="width: 80px">原价</th>
                        <th style="width: 80px">优惠价</th>
                        <th style="width: 80px">总金额</td>
                        <th style="width: 120px">支付方式</td>
                        <th style="width: 80px">状态</td>
                        <th style="width: 150px">预定时间</td>
                        <th style="width: 150px">下单时间</td>
                        <th style="width: 300px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $row}
                    <tr>

                        <td class="with-checkbox">
                            <input type="checkbox" name="check" value="{$row['id']}">
                        </td>
                        <td>{$row['orderno']} </td>
                        <td>{$row['uname']} </td>
                        <td>{$row['utel']} </td>
                        <td>{$row['ordernum']}</td>
                        <td>{$row['iname']}</td>
                        <td>{$row['o_yprice']}</td>
                        <td>{$row['o_xprice']}</td>
                        <td>{$row['zf_price']}</td>
                        <td>{if $row['pay_type'] == 1}立即支付{else if $row['pay_type'] == 2}现场支付{/if}</td>
                        <td>{php echo $this->getStatusText($row['status'])}</td>

                        <td>{php echo date("Y-m-d", $row['ordertime'])}</td>
                        <td>{php echo date("Y-m-d H:i", $row['createtime'])}</td>
                        <td >
                            <a class="btn  btn-default" rel="tooltip" href="{php echo $this->createWebUrl('OrderDetail',array('oid'=>$row['id'],'fid'=>$row['fid']))}" onclick="" title="订单详细"><i class="glyphicon glyphicon-file">订单详细</i></a>

                            <a class="btn  btn-default" rel="tooltip" href="#" onclick="drop_confirm('您确定要处理这条订单吗?', '{php echo $this->createWebUrl('OrderList',array('op'=>cl,'id'=>$row['id']))}');" title="处理订单">处理订单<i class="glyphicon glyphicon-ok"></i></a>
                            <a class="btn  btn-default" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?', '{php echo $this->createWebUrl('OrderList',array('op'=>delete,'id'=>$row['id']))}');" title="删除">删除<i class="glyphicon glyphicon-remove"></i></a>
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="15">
                            <input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
                        </td>
                    </tr>
                    </tbody>
                </table>
                {$pager}
            </div>

        </div>
    </div>
</div>
<script>
    $(function(){

        $(".check_all").click(function(){

            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").each(function(i){
                $(this).get(0).checked=checked;
            });

        });


        $("input[name=deleteall]").click(function(){


            var check = $("input:checked");
            if (check.length < 1){
                alert('请选择要删除的记录!');
                return false;
            }
            if (confirm("确认要删除选择的记录?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });


                $.post('{php echo $this->createWebUrl('DeleteOrder')}', {idArr:id}, function(data){

                    if(data.code==200) {
                        alert("删除成功");
                        location.reload();
                    } else {
                        alert("删除出错，稍后再试!");
                    }

                }, 'json');
            }

        });
    });</script>
<script>
    function drop_confirm(msg, url){
        if (confirm(msg)){
            window.location = url;
        }
    }
</script>

{template 'common/footer'}